package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.ModuleelementQuery;
import com.gec.zhs.entity.po.Moduleelement;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.ModuleelementService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 模块元素表(需要权限控制的按钮) Controller
 */
@RestController("moduleelementController")
@RequestMapping("/moduleelement")
public class ModuleelementController extends ABaseController{

	@Resource
	private ModuleelementService moduleelementService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(ModuleelementQuery query){
		return getSuccessResponseVO(moduleelementService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Moduleelement bean) {
		moduleelementService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Moduleelement> listBean) {
		moduleelementService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Moduleelement> listBean) {
		moduleelementService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getModuleelementById")
	public ResponseVO getModuleelementById(String id) {
		return getSuccessResponseVO(moduleelementService.getModuleelementById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateModuleelementById")
	public ResponseVO updateModuleelementById(Moduleelement bean,String id) {
		moduleelementService.updateModuleelementById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteModuleelementById")
	public ResponseVO deleteModuleelementById(String id) {
		moduleelementService.deleteModuleelementById(id);
		return getSuccessResponseVO(null);
	}
}